Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

125
Views
"ontimeupdate" no funciona en mi JavaScript

Estoy tratando de generar el tiempo de duración del video a medida que avanza usando el controlador de eventos ontimeupdate en el video, pero no funciona.

También agregué un console.log en el código para probar, pero no funciona.

Este es el código HTML:

 <video id="poster" class="w-100 h-100 image-align" autoplay muted loop src="<?= word("URL_VIDEO") ?>" loading="lazy"></video> <span id="poster-duration" class="ms-4 text-white">00:00</span>

Aquí está mi guión:

 window.addEventListener('load', function() { var poster = document.getElementById('poster'); poster.ontimeupdate = function(){ document.getElementById('poster-duration').innerText = addO(Math.floor(poster.duration/60)) + ':' + addO(Math.round(poster.duration%60)); console.log("hello") }; function addO(n){ if( n.toString().length < 2 ){ return '0'+n; } return n; } // ... });
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!